package com.android.settings.wifi.tether.entitlement_setting_client;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Context;
import android.os.Bundle;
import android.util.Log;
import android.widget.CompoundButton;
import android.widget.Switch;

public class WifiTetherSwitchController extends AppCompatActivity implements CompoundButton.OnCheckedChangeListener {

    private MobileHotspotClient mobileHotspotClient;
    private Context context;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        mobileHotspotClient = new MobileHotspotClient(getApplicationContext());
        Switch testSwitch = findViewById(R.id.wifiTetherSwitch_Control);
        testSwitch.setOnCheckedChangeListener(this);
    }

    @Override
    public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
        if (isChecked){
            try {
                mobileHotspotClient.startBindMhsService();
            } catch (RuntimeException e){
                e.printStackTrace();
            }
        } else {
            mobileHotspotClient.stopBindMhsService();
        }
    }
}